<template>
	<view class="contain">
		<view class="card-contain">
			<view class=" card-public">
				<text>店铺号：{{detailInfo.storeId}}</text>
				<text>联系人：{{detailInfo.connectorName}}/{{detailInfo.connectorPhone}}</text>
				<text>店铺地址：{{detailInfo.address}}</text>
				<text>设备安装时间：{{item.installStateDate|| ''}}</text>
			</view>
			<!-- 现场反馈 -->

			<view class="zong card-public">
				<u-collapse accordion>
					<u-collapse-item title="备注" name="Docs guide">
						<view class="user_box" style="width: 80%; margin: 40rpx auto;">
							<view class="user_for" v-for="(list,id) in remarklist" :key="id">
								<view class="line_box">
									<!-- 圆球 -->
									<view class="line_radio"
										:style="{ backgroundColor :  '#0055ff' , border: 'solid 6rpx #55aaff' }">
									</view>
									<!-- 线 -->
									<view class="line_for" v-for="item in 3" :key="item" v-if="id<remarklist.length-1"
										:style="{ backgroundColor : '#0055ff' }">
									</view>
								</view>
								<view class="right_box">
									<view class="title" :style="{ color : '#0055ff'}">{{list.title}}
										<text style="margin-left: 20rpx;" v-if="list.title1">({{list.title1}})</text>
									</view>
									<view class="desc" :style="{ color : '#0055ff'}">
										{{list.desc||'无'}}
									</view>
								</view>
							</view>
						</view>
					</u-collapse-item>
				</u-collapse>
			</view>
			<!-- 开店图纸 -->
			<view class="card-public">
				<view class="child-card-public">
					开店图纸
				</view>
				<view class="image-item" v-for="(item,index) in fileList0" :key="index">
					<view class="image-content">
						<image @click="previewfileList0Image(item.url,0)" :src="item.url"
							style="width: 100px; height: 100px; background-color: #eeeeee;"></image>
					</view>
					<view class="image-title">{{item.text}}</view>
				</view>
			</view>

			<!-- 勘察阶段 -->
			<view class="card-public" v-if="countCount>=1 && yesOrNot>=1">

				<view class="child-card-public">设备发货状态：{{item.eqDeState}}</view>
				<view class="child-card-public">运单号:{{item.trackingNumber}}</view>
				<view class="child-card-public">
					现场勘察照片
				</view>
				<view class="">
					<u-upload :disabled="!(countCount==1)" :deletable="countCount==1" :fileList="fileList1"
						@afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10"></u-upload>
				</view>
				<text>现场勘察情况反馈：</text>
				<u--input placeholder="请输入:" height="10rpx" type="textarea" v-model="item.siteSurveyStateFeedback"
					:disabled="!(countCount==1)" clearable>
				</u--input>
				<view class="child-card-public">
					弱电设备照片
				</view>
				<view class="image-item" v-for="(item,index) in fileList5" :key="index">
					<view class="image-content">
						<image @click="previewfileList0Image(item.url,5)" :src="item.url"
							style="width: 100px; height: 100px; background-color: #eeeeee;"></image>
					</view>
					<view class="image-title">{{item.text}}</view>
				</view>

				<view v-if="countCount>=2">
					提交时间:{{detailInfo.siteSurveyTime||''}}
				</view>
			</view>

			<!--综合布线-->
			<view class="card-public" v-if="countCount>=2  && yesOrNot>=2">

				<view class="child-card-public">综合布线实施状态：
					<u--input placeholder="请输入" type="number" height="10rpx" v-model="item.esWireState"
						:disabled="!(countCount==2)" clearable>
					</u--input>
				</view>

				<view class="child-card-public">
					综合布线现场照片
				</view>
				<view class="">
					<u-upload :disabled="!(countCount==2)" :deletable="countCount==1" :fileList="fileList2"
						@afterRead="afterRead" @delete="deletePic" name="2" multiple :maxCount="10"></u-upload>
				</view>
				<text>现场布线状态反馈：</text>
				<u--input placeholder="请输入:" height="10rpx" type="textarea" v-model="item.siteWireStateFeedback"
					:disabled="!(countCount==2)" clearable>
				</u--input>
				<view class="child-card-public">
					弱电端接状态照片：
				</view>
				<view class="">
					<u-upload :disabled="!(countCount==2)" :deletable="countCount==1" :fileList="fileList6"
						@afterRead="afterRead" @delete="deletePic" name="6" multiple :maxCount="10"></u-upload>
				</view>


				<view class="child-card-public">
					是否收到货物：
					<radio-group @change="isGetChange" style="display:inline-block;">
						<label class="uni-list" v-for="(Item, index) in isGetChoose" :key="index">
							<radio :disabled="!(countCount==2)" :value="Item.value"
								:checked="Item.value == item.esAccept" />
							<text style="margin-right: 10px;">{{Item.name}}</text>
						</label>
					</radio-group>
				</view>
				<view v-if="countCount>=3">
					提交时间:{{detailInfo.esWireTime||''}}
				</view>
			</view>

			<!-- it设备安装阶段 -->
			<view class="card-public" v-if="countCount>=3  && yesOrNot>=3">
				<view class="child-card-public">设备安装时间：{{item.itInstallTime}}</view>
				<view class="child-card-public">
					设备安装照片
				</view>
				<view class="">
					<u-upload :disabled="!(countCount==3)" :deletable="countCount==3" :fileList="fileList3"
						@afterRead="afterRead" @delete="deletePic" name="3" multiple :maxCount="10"></u-upload>
				</view>
				<view class="child-card-public">
					签单
				</view>
				<view class="">
					<u-upload :disabled="!(countCount==3)" :deletable="countCount==3" :fileList="fileList4"
						@afterRead="afterRead" @delete="deletePic" name="4" multiple :maxCount="10"></u-upload>
				</view>
				<view class="child-card-public">
					<text>确认到场时间：</text>
					<text @click=" countCount==3&&(arriveTimeShow = true)">{{item.arriveTime}}</text>
					<u-datetime-picker @confirm="arriveTimeConfirm" @cancel="arriveTimeShow=false"
						:show="arriveTimeShow" mode="datetime" :minDate="Date.now()">
					</u-datetime-picker>
<!-- 					<uni-datetime-picker v-model="item.arriveTime" :disabled="countCount!=3" /> -->
				</view>
				<view v-if="countCount>=4">
					提交时间:{{detailInfo.itInstallTime||''}}
				</view>
			</view>
			<view v-if="yesOrNot==countCount" class="sub">
				<u-button class="btns" type="primary" @click="save" text="保存草稿"></u-button>
				<!-- 				<u-button class="btns" type="warning" @click="partSub" text="阶段提交"></u-button> -->
				<u-button class="btns" type="success" @click="sub" text="提交" :disabled="subDisabled"></u-button>
			</view>
			<view class="card-public" id="openButton" v-if="(yesOrNot!=countCount)&&(countCount<=3)&&notChecked">
				<u-button text="开始" type="warning" @click="changeYesOrNot"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import request from '../../../utils/request.js'
	export default {
		data() {
			return {
				canchange: true,
				BaseUrl: "",
				item: {
					esAccept: false, //是否收到货物
					arriveTime: null, //确认到场时间
					workOrderId: '',
					siteSurveyStateFeedback: '', //现场勘察情况反馈
					siteSlingyurveyTime: null, //现场勘查时间
					siteWireStateFeedback: '', //现场布线状态反馈
					esWireTime: null, //综合布线时间
					esAccept: null,
					itInstallTime: null, //it设备安装时间
					workOrderStatus: undefined, //工单状态
					workOrderTypeId: '', //工单类型
					trackingNumber: '', //运单号
					eqDeState: '', //设备发货状态
					esWireState: null, //综合布线实施状态
				},
				arriveTimeShow: false,
				// isOptionalDateShow: false,
				// wireStateTimeShow: false,
				// eqIsOptionalTimeShow: false,
				yesOrNot: 0, //是否开始
				startTime: undefined, //点击开始按钮之后
				endTime: undefined, //点击提交之后
				countCount: 1,
				workOrderImagesBos: [],
				detailInfo: {},
				remarkinfo: {},
				fileList0: [], //开店图纸
				fileList1: [], //勘察图片
				fileList2: [], //综合布线现场图片
				fileList3: [], //设备安装图片
				fileList4: [], //签单
				fileList5: [], //弱电设备照片
				fileList6: [], //adidas开店弱电端接状态图
				remarklist: [],
				// orderRemark: {
				// 	remarkType: 13,
				// 	remark: undefined,
				// 	workOrderId: undefined
				// },
				value: null,
				isGetChoose: [{
					value: 1,
					name: '已收货'
				}, {
					value: 0,
					name: '未收货'
				}],
				subDisabled: false,
				notChecked: true, //不在审核阶段
				// show: {
				// 	show1: false,
				// 	show2: false,
				// 	show3: false,
				// 	show4: false,
				// },
			};
		},
		computed: {
			workid() {
				return this.detailInfo.workOrderId[0] + this.detailInfo.workOrderId[1] + this.detailInfo.workOrderId[2]
			}
		},
		onLoad(option) {
			uni.showLoading({
				title: '正在加载中'
			})
			// uni.getStorageSync(option.workOrderId)
			// uni.removeStorageSync('item');
			this.mountSelect(option.workOrderId)
			this.BaseUrl = getApp().globalData.BaseUrl
			if (option.canchange == "true") {
				this.canchange = true
			} else {
				this.canchange = false
			}
			uni.hideLoading()
		},
		methods: {
			// 改变按钮
			changeYesOrNot() {
				this.yesOrNot += 1
				this.startTime = this.gettime()
			},
			// 预览图片
			previewfileList0Image(demoUrl, index) {
				console.log(demoUrl);
				let urlArray = []
				this[`fileList${index}`].forEach((item) => {
					urlArray.push(item.url)
				})
				console.log(urlArray);
				uni.previewImage({
					urls: urlArray,
					current: demoUrl + '',
					success: (successres) => {
						console.log('success:', successres);
					},
					fail: (errorMessage) => {
						console.log('errorMessage:', errorMessage);
					},
					complete: (res) => {
						console.log(res);
					}
				})
			},

			// 时间格式
			changeTime(value) {
				let time = new Date()
				if (value) {
					time = new Date(value)
				}
				let year = time.getFullYear() + ''
				let month = (time.getMonth() + 1) + ''
				let date = time.getDate() + ''
				let h = time.getHours() + ''
				let m = time.getMinutes() + ''
				let s = time.getSeconds() + ''
				month = month > 9 ? month : '0' + month;
				date = date > 9 ? date : '0' + date;
				h = h > 9 ? h : '0' + h
				s = s > 9 ? s : '0' + s
				m = m > 9 ? m : '0' + m
				const tt = year + "-" + month + "-" + date + " " + h + ":" + m + ":" + s;
				return tt
			},
			arriveTimeConfirm(evt) {
				this.item.arriveTime = this.changeTime(evt.value)
				this.arriveTimeShow = false
			},
			// isOptionalDateConfirm(evt) {
			// 	this.item.isOptionalDate = this.changeTime(evt.value)
			// 	this.isOptionalDateShow = false
			// },
			// wireStateTimeConfirm(evt) {
			// 	this.item.wireStateTime = this.changeTime(evt.value)
			// 	this.wireStateTimeShow = false
			// },
			// eqIsOptionalTimeConfirm(evt) {
			// 	this.item.eqIsOptionalTime = this.changeTime(evt.value)
			// 	this.eqIsOptionalTimeShow = false
			// },
			// formatter(type, value) {
			// 	if (type === 'year') {
			// 		return `${value}年`
			// 	}
			// 	if (type === 'month') {
			// 		return `${value}月`
			// 	}
			// 	if (type === 'day') {
			// 		return `${value}日`
			// 	}
			// 	return value
			// },
			// logSingState() {
			// 	console.log('singState:', this.item.signState);
			// },
			isGetChange(evt) {
				console.log('isGetChange方法', evt.detail.value);
				this.item.esAccept = evt.detail.value;
				console.log(this.item.isGet);
			},
			// iseqIsPresentChange(evt) {
			// 	console.log('iseqIsPresentChange方法', evt.detail.value);
			// 	this.item.eqIsPresent = evt.detail.value;
			// 	console.log(this.item.eqIsPresent);
			// },
			// changeArriveTime(e) {
			// 	this.item.arriveTime = e.detail.value
			// },
			// changeisOptionalDate(e) {
			// 	this.item.isOptionalDate = e.detail.value
			// },
			// changewireStateTime(e) {
			// 	this.item.wireStateTime = e.detail.value
			// },
			// changeeqIsOptionalTime(e) {
			// 	this.item.eqIsOptionalTime = e.detail.value
			// },
			getDate() {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			getHour() {
				var nowdate = new Date();
				var h = nowdate.getHours()
				var m = nowdate.getMinutes()
				var s = nowdate.getSeconds()
				return `${h}:${m}:${s}`;
			},
			gettime() {
				var nowdate = new Date();
				var month = nowdate.getMonth() + 1
				var date = nowdate.getDate()
				var h = nowdate.getHours()
				var m = nowdate.getMinutes()
				var s = nowdate.getSeconds()
				month = month > 9 ? month : '0' + month;
				date = date > 9 ? date : '0' + date;
				h = h > 9 ? h : '0' + h;
				m = m > 9 ? m : '0' + m;
				var nowtime = month + "-" + date + " " + h + ":" + m;
				return nowtime
			},
			// async confirm(e, id) {
			// 	console.log('confirm', e)
			// 	if (id == 1) {
			// 		if (e.value[0] == "其他") {
			// 			this.item.faultClass = "100"
			// 			this.closeSelect()
			// 		} else {
			// 			this.item.faultClass = e.indexs[0].toString()
			// 			this.closeSelect()
			// 		}
			// 	} else if (id == 2) {
			// 		this.item.faultCode = e.indexs[0].toString()
			// 		await this.closeSelect()
			// 	} else if (id == 3) {
			// 		this.item.soluteCode = e.indexs[0].toString()
			// 		await this.closeSelect()
			// 	} else if (id == 4) {
			// 		if (e.value[0] == "远程") {
			// 			this.item.repairType = "remote"
			// 			await this.closeSelect()
			// 		} else if (e.value[0] == "上门") {
			// 			this.item.repairType = "Onsite"
			// 			await this.closeSelect()
			// 		}

			// 	}

			// },
			// closeSelect() {
			// 	this.show.show1 = false
			// 	this.show.show2 = false
			// 	this.show.show3 = false
			// 	this.show.show4 = false
			// },
			clearLocal() {
				uni.removeStorageSync(this.detailInfo.workOrderId);
				uni.removeStorageSync(this.detailInfo.workOrderId + "img");
				uni.removeStorageSync(this.detailInfo.workOrderId + ("fileList1"));
				uni.removeStorageSync(this.detailInfo.workOrderId + ("fileList2"));
				uni.removeStorageSync(this.detailInfo.workOrderId + ("fileList3"));
				uni.removeStorageSync(this.detailInfo.workOrderId + ("fileList4"));
				uni.removeStorageSync(this.detailInfo.workOrderId + ("fileList6"));
				uni.removeStorageSync(this.detailInfo.workOrderId + "item");
			},
			//提交
			sub() {
				console.log(typeof this.item.esWireState);
				if ((typeof this.item.esWireState) != 'number') {
					uni.showToast({
						title: '综合布线实施状态必须为数字类型',
						icon: 'none'
					})
					this.item.esWireState = null;
					return
				}
				this.subDisabled = true;
				setTimeout(() => {
					this.subDisabled = false;
				}, 3000);
				// uni.removeStorageSync(this.detailInfo.workOrderId)
				// uni.removeStorageSync(this.detailInfo.workOrderId + "img")
				// uni.removeStorageSync(this.detailInfo.workOrderId + ("filelist"+this.countCount))
				// uni.removeStorageSync(this.detailInfo.workOrderId + "item")
				this.item.workOrderId = this.detailInfo.workOrderId
				// this.item.finishTime = this.gettime()

				var obj = this.item
				for (var key in obj) {
					if (!obj[key]) {
						delete obj[key]
					}
				}
				this.item = obj
				if (this.workid == "KOa") {
					this.adopen()
				} else if (this.workid == "KOl") {
					this.lvopen()
				} else if (this.workid == "KCa") {
					this.adclose()
				} else if (this.workid == "KCl") {
					this.lvclose()
				} else if (this.workid == "KMa") {
					this.adma()
				} else if (this.workid == "KMl") {
					this.lvma()
				} else if (this.workid == "KOO") {
					this.koo()
				} else if (this.workid == "KMr") {
					this.rgma()
				}
			},

			//保存草稿
			save() {
				uni.setStorage({
					key: this.detailInfo.workOrderId, // 存储值的名称
					data: this.item, //   将要存储的数据
					success: res => {
						// 成功后的回调
						console.log('存储item成功');
					}
				});
				uni.setStorage({
					key: this.detailInfo.workOrderId + "img", // 存储值的名称
					data: this.workOrderImagesBos, //   将要存储的数据
					success: res => {
						// 成功后的回调
						console.log('存储img成功');
					}
				});
				const setArray = [1, 2, 3, 4, 6];
				for (let n of setArray) {
					uni.setStorage({
						key: this.detailInfo.workOrderId + ("fileList" + n), // 存储值的名称
						data: this[`fileList${n}`], //   将要存储的数据
						success: res => {
							// 成功后的回调
							console.log('图片存储成功');
						}
					});
				}

				uni.setStorage({
					key: this.detailInfo.workOrderId + "item", // 存储值的名称
					data: this.item, //   将要存储的数据
					success: res => {
						console.log(this.item);
						// 成功后的回调
						console.log('存储成功');
					}
				});
				uni.reLaunch({
					url: '/pages/home/ad/admain'
				})

			},
			get(option) {
				console.log('获取成功');
				uni.getStorage({
					key: option.workOrderId, // 储存在本地的变量名
					success: res => {
						// 成功后的回调
						console.log('获取item');
						this.item = res.data // hello  这里可做赋值的操作 
					}
				})
				uni.getStorage({
					key: option.workOrderId + "img", // 储存在本地的变量名
					success: res => {
						// 成功后的回调
						console.log('获取本地变量');
						this.workOrderImagesBos = res.data // hello  这里可做赋值的操作
					}
				})
				const setArray = [1, 2, 3, 4, 6];
				for (let n of setArray) {
					uni.getStorage({
						key: option.workOrderId + ("fileList" + n), // 存储值的名称
						success: res => {
							// 成功后的回调
							this[`fileList${n}`] = res.data;
						}
					});
				}
				uni.getStorage({
					key: option.workOrderId + "item", // 储存在本地的变量名
					success: res => {
						console.log(res);
						// 成功后的回调
						this.item = res.data // hello  这里可做赋值的操作
					}
				})
			},
			// 删除图片
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1)
			},
			// 新增图片
			async afterRead(event) {
				// 当设置 mutiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this[`fileList${event.name}`].length
				lists.map((item) => {
					this[`fileList${event.name}`].push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url, event.name)
					let item = this[`fileList${event.name}`][fileListLen]
					this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
			},
			// 上传图片，获取图片url
			uploadFilePromise(url, name) {

				return new Promise((resolve, reject) => {
					uni.$u.http.upload(`${this.BaseUrl}/prod-api/system/oss/upload`, {
						params: {},
						/* 会加在url上 */
						// #ifdef APP-PLUS || H5
						files: [], // 需要上传的文件列表。使用 files 时，filePath 和 name 不生效。App、H5（ 2.6.15+）
						// #endif
						filePath: url, // 要上传文件资源的路径。
						// 注：如果局部custom与全局custom有同名属性，则后面的属性会覆盖前面的属性，相当于Object.assign(全局，局部)
						custom: {
							auth: true
						}, // 可以加一些自定义参数，在拦截器等地方使用。比如这里我加了一个auth，可在拦截器里拿到，如果true就传token
						name: 'file', // 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
						// #ifdef H5 || APP-PLUS
						timeout: 60000, // H5(HBuilderX 2.9.9+)、APP(HBuilderX 2.9.9+)
						// #endif
						header: {
							Authorization: uni.getStorageSync("token")
						},
						/* 会与全局header合并，如有同名属性，局部覆盖全局 */
						formData: {}, // HTTP 请求中其他额外的 form data
						// 返回当前请求的task, options。请勿在此处修改options。非必填
						getTask: (task, options) => {},
					}).then((res) => {
						if (name == 1) {
							this.workOrderImagesBos.push({
								imagePath: res.data.data.url.replace("blob:", ""),
								imageTypeId: "50",
								workOrderId: this.detailInfo.workOrderId
							})
						} else if (name == 2) {
							this.workOrderImagesBos.push({
								imagePath: res.data.data.url.replace("blob:", ""),
								imageTypeId: "52",
								workOrderId: this.detailInfo.workOrderId
							})
						} else if (name == 3) {
							this.workOrderImagesBos.push({
								imagePath: res.data.data.url.replace("blob:", ""),
								imageTypeId: "54",
								workOrderId: this.detailInfo.workOrderId
							})
						} else if (name == 4) {
							this.workOrderImagesBos.push({
								imagePath: res.data.data.url.replace("blob:", ""),
								imageTypeId: "1",
								workOrderId: this.detailInfo.workOrderId
							})
						} else if (name == 6) {
							this.workOrderImagesBos.push({
								imagePath: res.data.data.url.replace("blob:", ""),
								imageTypeId: "15",
								workOrderId: this.detailInfo.workOrderId
							})
						}
						resolve(res.data.data.url)
						// 返回的res.data 已经进行JSON.parse
					}).catch(err => {

					})

				})
			},

			//请求有关
			async mountSelect(workOrderId) {
				await request({
					url: "prod-api/system/ad-workOrder/" + workOrderId,
					method: "get",
				}).then((res) => {
					console.log('mountSelect方法:', res.data);
					if (res.code < 300) {
						if (workOrderId[1] === "O") {
							this.detailInfo = res.data.selectAdOpenWorkOrderVo
							this.remarkinfo = res.data.workOrderRemarkVo
							this.item = res.data.selectAdOpenWorkOrderVo
							this.changeStatus()
							this.doremark(res.data.workOrderRemarkVos)
							let couNum = -1
							res.data.workOrderImagesVos.forEach((item, index) => {
								switch (item.imageTypeId) {
									case "20":
										couNum = 0;
										break;
									case "50":
										couNum = 1;
										break;
									case "52":
										couNum = 2;
										break;
									case "54":
										couNum = 3;
										break;
									case "1":
										couNum = 4;
										break;
									case "56":
										couNum = 5;
										break;
									case "15":
										couNum = 6;
										break;
									default:
										couNum = -1;
										break;
								}
								if (couNum >= 0) {
									this[`fileList${couNum}`].push({
										type: "image",
										url: item.imagePath,
										status: "success",
										name: "",
										message: "",
										thumb: "",
										size: 60489
									})
								}

							})
						} else if (workOrderId[1] === "C") {
							this.detailInfo = res.data.selectAdCloseWorkOrderVo
						} else if (workOrderId[1] === "M") {}
					}
				}).then((res) => {
					this.get({
						workOrderId
					})
					uni.hideLoading()
				})


			},
			// 选择状态
			changeStatus() {
				const count = this.item.workOrderStatus
				if (count == 5 || count == 30 || count == 31) { //现场勘察阶段
					this.countCount = 1;
				} else if (count >= 32 && count <= 35) { //综合布线阶段
					this.countCount = 2;
					if (count == 32) {
						this.notChecked = false;
						uni.showToast({
							title: '上一阶段还未审核完毕，请稍等',
							icon: 'none'
						})
					}
				} else if (count >= 36 && count <= 39) { //it设备阶段
					this.countCount = 3;
					if (!this.item.arriveTime) {
						this.item.arriveTime = this.changeTime(null)
					}
					if (count == 36) {
						this.notChecked = false;
						uni.showToast({
							title: '上一阶段还未审核完毕，请稍等',
							icon: 'none'
						})
					}
				} else if (count >= 40) {
					this.countCount = 4;
				} else {

				}
				this.yesOrNot = this.countCount - 1
				console.log('count:', this.countCount);
				console.log('yesOrNot:', this.yesOrNot);
			},
			//导出订单图片
			downImages(type) {
				request({
					url: "prod-api/system/orderImages/downloadList?imagesBos=" + this.detailInfo.workOrderId,
					method: "get",
				}).then((res) => {
					console.log(res)
					if (res.code < 300) {
						uni.downloadFile({
							url: res.data,
							success: (res) => {
								if (res.statusCode === 200) {
									uni.saveImageToPhotosAlbum({
										filePath: res.tempFilePath,
										success: function() {
											uni.showToast({
												title: "保存成功",
												icon: "none"
											});
										},
										fail: function() {
											uni.showToast({
												title: "保存失败，请稍后重试",
												icon: "none"
											});
										}
									});
								}
							}
						})
					}
				})
			},
			async adopen() {
				this.endTime = this.gettime() // 结束时间
				const midTime = this.startTime + ' ~ ' + this.endTime //传入每次提交的时间
				this.item.workOrderTypeId = 0
				switch (this.countCount) {
					case 1:
						this.item.workOrderStatus = 32;
						this.item.siteSurveyTime = midTime;
						break;
					case 2:
						this.item.workOrderStatus = 36;
						this.item.esWireTime = midTime;
						break;
					case 3:
						this.item.workOrderStatus = 40;
						this.item.itInstallTime = midTime;
						break;
					default:
						this.item.workOrderStatus = null;
						break;
				}

				console.log(this.item)
				console.log(this.workOrderImagesBos)
				// this.orderRemark.workOrderId = this.item.workOrderId
				// await request({
				// 	url: "prod-api/system/orderRemark",
				// 	method: "post",
				// 	data: this.orderRemark
				// }).then((res) => {
				// 	console.log(res)
				// })
				await request({
					url: "prod-api/system/ad-workOrder",
					method: "put",
					data: {
						updateAdOpenWorkOrderBo: {
							workOrderId: this.item.workOrderId
						},
						workOrderImagesBos: this.workOrderImagesBos
					}
				})
				await request({
					url: "prod-api/system/ad-workOrder/edit/open",
					method: "put",
					data: this.item,
				}).then((res) => {
					console.log(res)
					if (res.code < 300) {
						this.clearLocal()
						uni.reLaunch({
							url: '/pages/home/ad/admain'
						})
					}
				})
			},
			doremark(data = []) {
				console.log(data)
				data.forEach((item, index) => {
					this.remarklist.push({
						id: index,
						title: item.remarkTypeName,
						title1: "",
						desc: item.remark,
						isture: true,
						url: ""
					})
				})
				console.log(this.remarklist)
			}
		}
	}
</script>

<style lang="scss">
	.contain {
		width: 100%;
		height: 100%;
		position: absolute;
		background-color: rgb(245, 245, 245);

		.card-contain {
			.card-public {
				display: flex;
				flex-direction: column;
				background-color: white;
				justify-content: space-between;
				width: 90%;
				margin: 30upx 5%;
				box-sizing: border-box;
				padding: 10upx 0;
				padding-left: 40upx;
				border-radius: 30upx 30upx 30upx 30upx;
				box-shadow: 0 0 15px rgb(232, 232, 232);

				.child-card-public {
					border-bottom: 1px solid gray;
					margin: 10px 0;
					padding: 5px 0;
				}

				.textline {
					border-bottom: 1px solid rgb(218, 219, 222);
					color: rgb(192, 196, 204);
					width: 100%;
					line-height: 60upx;
					font-size: 30rpx;
				}

				.radio {
					margin-top: 20upx;
				}

				text {
					font-size: 32upx;
					margin-top: 8upx;
					margin-bottom: 20upx;
				}
			}

			.btn {
				display: flex;
			}

		}

		.sub {
			display: flex;
			justify-content: space-between;

			button {
				width: 25%;
				height: 60upx;
			}

			padding-bottom: 100upx;
		}
	}

	.zong {

		.user_for {
			display: flex;
		}

		.item_year {
			font-size: 34rpx;
			height: 50rpx;
		}

		.line_for {
			width: 4rpx;
			height: 24rpx;
			margin: 0 20rpx 10rpx;
		}

		.line_radio {
			width: 20rpx;
			height: 20rpx;
			border-radius: 50%;
			position: relative;
			left: 50%;
			transform: translateX(-50%);
			top: 0;
		}

		.right_box {
			padding: 0rpx 20rpx 20rpx 20rpx;
		}

		.desc {
			font-size: 30rpx;
			display: flex;
			margin-top: 20rpx;
			align-items: center;

		}

	}
</style>
